
/*
 * Xclk 24Mhz
 * Pclk 72Mhz
 * linelength 1696(0x06a0)
 * framelength 2122(0x084a)
 * grabwindow_width 1080
 * grabwindow_height 1280
 * mipi 2 lane
 * 10 bit
 * max_framerate 30fps
 * mipi_datarate per lane 360Mbps
 */
static k_sensor_reg sc132gs_mipi_2lane_1080x1280_init[] =
{
    {0x0103, 0x01},
	{0x0100, 0x00},

	//PLL bypass
	{0x36e9, 0x80},
	{0x36f9, 0x80},

	{0x3018, 0x32},
	{0x3019, 0x0c},
	{0x301a, 0xb4},
	{0x3031, 0x0a},
	{0x3032, 0x60},
	{0x3038, 0x44},
	{0x3207, 0x17},
	{0x320c, 0x05},             // 0x5dc = 1500
	{0x320d, 0xdc},
	{0x320e, 0x09},             // 0x960 = 2400
	{0x320f, 0x60},
	{0x3250, 0xcc},
	{0x3251, 0x02},
	{0x3252, 0x09},
	{0x3253, 0x5b},
	{0x3254, 0x05},
	{0x3255, 0x3b},
	{0x3306, 0x78},
	{0x330a, 0x00},
	{0x330b, 0xc8},
	{0x330f, 0x24},
	{0x3314, 0x80},
	{0x3315, 0x40},
	{0x3317, 0xf0},
	{0x331f, 0x12},
	{0x3364, 0x00},
	{0x3385, 0x41},
	{0x3387, 0x41},
	{0x3389, 0x09},
	{0x33ab, 0x00},
	{0x33ac, 0x00},
	{0x33b1, 0x03},
	{0x33b2, 0x12},
	{0x33f8, 0x02},
	{0x33fa, 0x01},
	{0x3409, 0x08},
	{0x34f0, 0xc0},
	{0x34f1, 0x20},
	{0x34f2, 0x03},
	{0x3622, 0xf5},
	{0x3630, 0x5c},
	{0x3631, 0x80},
	{0x3632, 0xc8},
	{0x3633, 0x32},
	{0x3638, 0x2a},
	{0x3639, 0x07},
	{0x363b, 0x48},
	{0x363c, 0x83},
	{0x363d, 0x10},
	{0x36ea, 0x38},
	{0x36fa, 0x25},
	{0x36fb, 0x05},
	{0x36fd, 0x04},
	{0x3900, 0x11},
	{0x3901, 0x05},
	{0x3902, 0xc5},
	{0x3904, 0x04},
	{0x3908, 0x91},
	{0x391e, 0x00},
	{0x3e01, 0x11},     // 1200 x 16
	{0x3e02, 0x20},
	{0x3e09, 0x20},
	{0x3e0e, 0xd2},
	{0x3e14, 0xb0},
	{0x3e1e, 0x7c},
	{0x3e26, 0x20},
	{0x4418, 0x38},
	{0x4503, 0x10},
	{0x4837, 0x21},
	{0x5000, 0x0e},
	{0x540c, 0x51},
	{0x550f, 0x38},
	{0x5780, 0x67},
	{0x5784, 0x10},
	{0x5785, 0x06},
	{0x5787, 0x02},
	{0x5788, 0x00},
	{0x5789, 0x00},
	{0x578a, 0x02},
	{0x578b, 0x00},
	{0x578c, 0x00},
	{0x5790, 0x00},
	{0x5791, 0x00},
	{0x5792, 0x00},
	{0x5793, 0x00},
	{0x5794, 0x00},
	{0x5795, 0x00},
	{0x5799, 0x04},

	//flip
	//{0x3221, (0x3 << 5)},

	//mirror
	{0x3221, (0x3 << 1)},

	//flip & mirror
	//{0x3221, ((0x3 << 1)|(0x3 << 5))},

	//PLL set
	{0x36e9, 0x20},
	{0x36f9, 0x24},
    {REG_NULL, 0x00},

};

static k_sensor_reg sc132gs_mipi_2lane_1080x1280_120fps_init[] =
{
    {0x0103,0x01},
    {0x0100,0x00},
    {0x36e9,0x80},
    {0x36f9,0x80},
    {0x3018,0x32},
    {0x3019,0x0c},
    {0x301a,0xb4},
    {0x301f,0x3c},
    {0x3032,0x60},
    {0x3038,0x44},
    {0x3207,0x17},
    {0x320c,0x02},
    {0x320d,0xee},
    {0x3250,0xcc},

    // {0x320e,0x05},      // 1480
    // {0x320f,0xc8},

    {0x3251,0x02},
    {0x3252,0x05},
    {0x3253,0x41},
    {0x3254,0x05},
    {0x3255,0x3b},
    {0x3306,0x78},
    {0x330a,0x00},
    {0x330b,0xc8},
    {0x330f,0x24},
    {0x3314,0x80},
    {0x3315,0x40},
    {0x3317,0xf0},
    {0x331f,0x12},
    {0x3364,0x00},
    {0x3385,0x41},
    {0x3387,0x41},
    {0x3389,0x09},
    {0x33ab,0x00},
    {0x33ac,0x00},
    {0x33b1,0x03},
    {0x33b2,0x12},
    {0x33f8,0x02},
    {0x33fa,0x01},
    {0x3409,0x08},
    {0x34f0,0xc0},
    {0x34f1,0x20},
    {0x34f2,0x03},
    {0x3622,0xf5},
    {0x3630,0x5c},
    {0x3631,0x80},
    {0x3632,0xc8},
    {0x3633,0x32},
    {0x3638,0x2a},
    {0x3639,0x07},
    {0x363b,0x48},
    {0x363c,0x83},
    {0x363d,0x10},
    {0x36ea,0x36},
    {0x36eb,0x04},
    {0x36ec,0x03},
    {0x36ed,0x24},
    {0x36fa,0xe5},
    {0x36fb,0x05},
    {0x36fc,0x00},
    {0x36fd,0x04},
    {0x3900,0x11},
    {0x3901,0x05},
    {0x3902,0xc5},
    {0x3904,0x04},
    {0x3908,0x91},
    {0x391e,0x00},
    {0x3e01,0x53},
    {0x3e02,0xe0},
    {0x3e09,0x20},
    {0x3e0e,0xd2},
    {0x3e14,0xb0},
    {0x3e1e,0x7c},
    {0x3e26,0x20},
    {0x4418,0x38},
    {0x4503,0x10},
    {0x4837,0x0d},
    {0x5000,0x0e},
    {0x540c,0x51},
    {0x550f,0x38},
    {0x5780,0x67},
    {0x5784,0x10},
    {0x5785,0x06},
    {0x5787,0x02},
    {0x5788,0x00},
    {0x5789,0x00},
    {0x578a,0x02},
    {0x578b,0x00},
    {0x578c,0x00},
    {0x5790,0x00},
    {0x5791,0x00},
    {0x5792,0x00},
    {0x5793,0x00},
    {0x5794,0x00},
    {0x5795,0x00},
    {0x5799,0x04},
    {0x36e9,0x24},
    {0x36f9,0x51},
    {0x0100,0x01},

    //[gain<2]
    {0x33fa,0x01},
    {0x3317,0xf0},

    //[gain>=2]
    {0x33fa,0x02},
    {0x3317,0x14},

    {REG_NULL, 0x00},
};

/*
SensorName=SC132GS_MIPI_2L_60
width=1080     //sensor width
height=1280     //sensor height
sensorFormat=0     //0:RAW10 1:YUV 2:RAW8 3:RAW12 4:RAW12
sensorPort=2     //0:DVP 1:mipi_1x 2:mipi_2x 3:mipi_3x 4:mipi_4x 5:mtk_1x,6:mtk_2x
pwdn=1     //0:low 1:high
SlaveID=0x60     //sensor i2c address
i2c_mode=1     //0:8ADDR_8REG 1:16ADDR_8REG 2:8ADDR_16REG 3:16ADDR_16REG
SensorIDAddr=0x36ff     //sensor id register address
SensorID=0x0     //sensor id register value
disply_mode=3     //0:YCbYCr/RG_GB  1:YCrYCb/GR_BG  2:CbYCrY/GB_RG 3:CrYCbY/BG_GR
AVDD=2800     //sensor analog power
DOVDD=1800     //sensor io power
DVDD=1500     //sensor core power
mclk=12     //sensor input clock 6-99 Mhz
mipiclk=0     //0:mipiclk continuous 1:mipiclk LP
*/
static k_sensor_reg sc132gs_mipi_2lane_640x480_init[] =
{
    {0x0103,0x01},
    {0x0100,0x00},
    {0x36e9,0x80},
    {0x36f9,0x80},
    {0x3018,0x32},
    {0x3019,0x0c},
    {0x301a,0xb4},
    {0x301f,0x3c},
    {0x3032,0x60},
    {0x3038,0x44},
    {0x3207,0x17},
    {0x320c,0x02},
    {0x320d,0xee},
    {0x3250,0xcc},
    {0x3251,0x02},
    {0x3252,0x05},
    {0x3253,0x41},
    {0x3254,0x05},
    {0x3255,0x3b},
    {0x3306,0x78},
    {0x330a,0x00},
    {0x330b,0xc8},
    {0x330f,0x24},
    {0x3314,0x80},
    {0x3315,0x40},
    {0x3317,0xf0},
    {0x331f,0x12},
    {0x3364,0x00},
    {0x3385,0x41},
    {0x3387,0x41},
    {0x3389,0x09},
    {0x33ab,0x00},
    {0x33ac,0x00},
    {0x33b1,0x03},
    {0x33b2,0x12},
    {0x33f8,0x02},
    {0x33fa,0x01},
    {0x3409,0x08},
    {0x34f0,0xc0},
    {0x34f1,0x20},
    {0x34f2,0x03},
    {0x3622,0xf5},
    {0x3630,0x5c},
    {0x3631,0x80},
    {0x3632,0xc8},
    {0x3633,0x32},
    {0x3638,0x2a},
    {0x3639,0x07},
    {0x363b,0x48},
    {0x363c,0x83},
    {0x363d,0x10},
    {0x36ea,0x36},
    {0x36eb,0x04},
    {0x36ec,0x03},
    {0x36ed,0x24},
    {0x36fa,0xe5},
    {0x36fb,0x05},
    {0x36fc,0x00},
    {0x36fd,0x04},
    {0x3900,0x11},
    {0x3901,0x05},
    {0x3902,0xc5},
    {0x3904,0x04},
    {0x3908,0x91},
    {0x391e,0x00},
    {0x3e01,0x53},
    {0x3e02,0xe0},
    {0x3e09,0x20},
    {0x3e0e,0xd2},
    {0x3e14,0xb0},
    {0x3e1e,0x7c},
    {0x3e26,0x20},
    {0x4418,0x38},
    {0x4503,0x10},
    {0x4837,0x0d},
    {0x5000,0x0e},
    {0x540c,0x51},
    {0x550f,0x38},
    {0x5780,0x67},
    {0x5784,0x10},
    {0x5785,0x06},
    {0x5787,0x02},
    {0x5788,0x00},
    {0x5789,0x00},
    {0x578a,0x02},
    {0x578b,0x00},
    {0x578c,0x00},
    {0x5790,0x00},
    {0x5791,0x00},
    {0x5792,0x00},
    {0x5793,0x00},
    {0x5794,0x00},
    {0x5795,0x00},
    {0x5799,0x04},

    //640x480}
    {0x3200,0x00},
    {0x3201,0xdc},
    {0x3202,0x01},
    {0x3203,0x94},
    {0x3204,0x03},
    {0x3205,0x7b},
    {0x3206,0x03},
    {0x3207,0x83},
    {0x3208,0x02},
    {0x3209,0x80},
    {0x320a,0x01},
    {0x320b,0xe0},
    {0x3210,0x00},
    {0x3211,0x10},
    {0x3212,0x00},
    {0x3213,0x08},

    //240fps
    {0x320e,0x02},
    {0x320f,0xa3},
    {0x3252,0x02},
    {0x3253,0x9e},
    {0x3e01,0x02},
    {0x3e02,0x00},

    {0x4837,0x1b},
    {0x36ec,0x13},

    {0x36e9,0x24},
    {0x36f9,0x51},

    {REG_NULL, 0x00},
};
